package com.awphone.data;

import com.awphone.data.constant.CityConst;
import com.awphone.data.constant.EObjectType;

import javax.persistence.*;

/**
 * @author a_polyakov
 * Date: 03.03.13
 * Time: 22:35
 * Город
 */
@Entity
@Table(schema = CityConst.SCHEMA_NAME, name = CityConst.TABLE_NAME)
public class City extends AbstractObject {
    /**
     * Штат
     */
    private State state;
    /**
     * Наименование
     */
    private String name;
    /**
     * Часовой пояс
     */
    private Integer timeZone;
    /**
     * индекс
     */
    private String zipCode;
    /**
     * Площадь
     */
    private Double area;
    /**
     * Население
     */
    private Integer population;
    /**
     * Количество зданий
     */
    private Integer numberOfHouseholds;
    /**
     * Количество белых
     */
    private Integer populationWhite;
    /**
     * Количество черных
     */
    private Integer populationBlack;
    /**
     * Количество испаноязычного населения
     */
    private Integer populationHispanic;

    {
        setObjectType(EObjectType.CITY);
    }

    public City() {
    }

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = CityConst.S_STATE, nullable = false, updatable = false)
    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    @Column(name = CityConst.S_NAME, nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = CityConst.S_TIME_ZONE)
    public Integer getTimeZone() {
        return timeZone;
    }

    public void setTimeZone(Integer timeZone) {
        this.timeZone = timeZone;
    }

    @Column(name = CityConst.S_ZIP_CODE)
    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    @Column(name = CityConst.S_AREA)
    public Double getArea() {
        return area;
    }

    public void setArea(Double area) {
        this.area = area;
    }

    @Column(name = CityConst.S_POPULATION)
    public Integer getPopulation() {
        return population;
    }

    public void setPopulation(Integer population) {
        this.population = population;
    }

    @Column(name = CityConst.S_NUMBER_OF_HOUSEHOLDS)
    public Integer getNumberOfHouseholds() {
        return numberOfHouseholds;
    }

    public void setNumberOfHouseholds(Integer numberOfHouseholds) {
        this.numberOfHouseholds = numberOfHouseholds;
    }

    @Column(name = CityConst.S_POPULATION_WHITE)
    public Integer getPopulationWhite() {
        return populationWhite;
    }

    public void setPopulationWhite(Integer populationWhite) {
        this.populationWhite = populationWhite;
    }

    @Column(name = CityConst.S_POPULATION_BLACK)
    public Integer getPopulationBlack() {
        return populationBlack;
    }

    public void setPopulationBlack(Integer populationBlack) {
        this.populationBlack = populationBlack;
    }

    @Column(name = CityConst.S_POPULATION_HISPANIC)
    public Integer getPopulationHispanic() {
        return populationHispanic;
    }

    public void setPopulationHispanic(Integer populationHispanic) {
        this.populationHispanic = populationHispanic;
    }
}
